<?php

declare(strict_types=1);

namespace App\Controller;

use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Hyperf\Di\Annotation\Inject;

class ApiBaseController extends AbstractController
{
    public function success($msg = null,$data = []){
        $data = [
            'code'=>1,
            'msg'=>$msg,
            'data'=>$data
        ];
        return $this->response->json($data);
    }

    public function error($msg = null,$data = []){
        $data = [
            'code'=>0,
            'msg'=>$msg
        ];
        return $this->response->json($data);
    }
}
